/**********************************************************************
 * Filename: Cartao.java
 * Created: 2012/04/30
 * @author Fernando Brito e Abreu
 **********************************************************************/
package org.quasar.CopaPaises.businessLayer;

import java.util.Set;
import java.util.HashSet;

public class Cartao {
	public static Set<Cartao> allInstances = new HashSet<Cartao>();

	private int minuto;
	private TipoCartao tipo;
	private Membro membro;

	/**********************************************************************
	 * Default constructor
	 **********************************************************************/
	public Cartao() {
		allInstances.add(this);
	}

	/**********************************************************************
	 * Parameterized constructor
	 * 
	 * @param minuto
	 *            the minuto to initialize
	 * @param tipo
	 *            the tipo to initialize
	 * @param membro
	 *            the membro to initialize
	 **********************************************************************/
	public Cartao(int minuto, TipoCartao tipo, Membro membro) {
		this.minuto = minuto;
		this.tipo = tipo;
		this.membro = membro;
		allInstances.add(this);
	}

	/**********************************************************************
	 * Standard attribute getter
	 * 
	 * @return the minuto of the cartao
	 **********************************************************************/
	public int minuto() {
		return minuto;
	}

	/**********************************************************************
	 * Standard attribute setter
	 * 
	 * @param minuto
	 *            the minuto to set
	 **********************************************************************/
	public void setMinuto(int minuto) {
		this.minuto = minuto;
	}

	/**********************************************************************
	 * Standard attribute getter
	 * 
	 * @return the tipo of the cartao
	 **********************************************************************/
	public TipoCartao tipo() {
		return tipo;
	}

	/**********************************************************************
	 * Standard attribute setter
	 * 
	 * @param tipo
	 *            the tipo to set
	 **********************************************************************/
	public void setTipo(TipoCartao tipo) {
		this.tipo = tipo;
	}

	/**********************************************************************
	 * ONE2MANY getter for Cartao[*] <-> Membro[1]
	 * 
	 * @return the membro of the cartao
	 **********************************************************************/
	public Membro membro() {
		return membro;
	}

	/**********************************************************************
	 * ONE2MANY setter for Cartao[*] <-> Membro[1]
	 * 
	 * @param membro
	 *            the membro to set
	 **********************************************************************/
	public void setMembro(Membro membro) {
		this.membro = membro;
	}

	/**********************************************************************
	 * User-defined operation specified in SOIL/OCL
	 * 
	 * @param tipo
	 *            the tipo to set
	 * @param minuto
	 *            the minuto to set
	 **********************************************************************/
	public void inicializa(TipoCartao tipo, int minuto) {

	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see java.lang.Object#toString()
	 */
	@Override
	/**********************************************************************
	 * Object serializer
	 **********************************************************************/
	public String toString() {
		return "Cartao [minuto=" + minuto + ", tipo=" + tipo + ", membro="
				+ membro + "]\n";
	}

}
